<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>团队信息</title>
    <link href="../css/professional.css" rel="stylesheet" type="text/css">
    <script src="../jQuery/jquery-3.3.1.js"></script>
    <script src="../layer/layer.js"></script>
    <script src="../jQuery/jquery-3.3.1.js"></script>
    <script src="../layer/layer.js"></script>
    <script src="../js/jquery-2.1.1.min.js"></script>
    <script src="../js/jquery.form.min.js"></script>
    <script src="../js/main.js"></script>
    <script src="../js/del.js "></script>
    <link href="../css/professional.css" rel="stylesheet" type="text/css">
    <script src="../layer/layer.js"></script>
    <script>



        var id=URL;
        $.ajaxSetup({
            xhrFields: {
                withCredentials: isCrossDomain
            }
        });
        $(function () {
            var p=$.getUrlParam('pageno');
            $.get(mainurl+"admin/getAllTeam?pageno="+p,function (data) {
                //  alert("pageno:+++"+$.getUrlParam('pageno'))
                //   alert("success");
                //   alert("当前页码："+data.data.pageNum);
                var pageNum=data.data.pageNum;

                //   alert("总页码："+data.data.pages);
                var pages=data.data.pages;
                //   alert("最后一页："+data.data.lastPage);
                var lastPage=data.data.lastPage;
                //   alert("当前页的数据量:"+data.data.size);
                var size=data.data.size;
                //   alert("每页的数据量："+pageSize);
                var pageSize=data.data.pageSize;
                // alert(data.data.list);
                if(checkData(data)){
                    var dat = data.data.list;

                    for(var i=0; i<dat.length; i++) {
                        var d = dat[i];
                        var tid=d.tid;
                        var name=d.name;
                        var username=d.username;
                        var img=mainurl+d.img;
                        var introduce=d.introduce;
                        var audit=d.audit;

                        if(audit==0){
                            str="未审核"
                        }if (audit==1){
                            str="通过";
                        }if (audit==-1) {
                            str="不通过";
                        }

                        str1=" <div class=\"info\">\n" +
                            "            <div class=\"top\">\n" +
                            "                <div class=\"del\"><a onclick=\"delService("+tid+","+pageNum+") \"> <img src=\"../img/close.png\" style=\"width: 16px;height: 16px\"></a></div>\n" +
                            "                <div style=\"min-width: 200px\">\n" +
                            "                    <img src=\""+img+"\" class=\"info_teach\">\n" +
                            "                    <p class=\"specific\">\n" +
                            "                         <label class=\"name\">团队编号:"+tid+"</label><br/><label> 团队名称:"+name+" </label><br/><label>团队负责人:"+username+"  </label><br/><label class=>团队介绍:"+introduce+"</label> </p>\n" +
                            "                </div>\n" +
                            "            </div>\n" +
                            "            <div class=\"info_operation\">\n" +
                            "\n" +
                            "                <label onclick=\"examine("+pageNum+","+tid+")\"  class=\"operation\"><img src=\"../img/examine.png\" style=\"width: 20px;height: 18px\">审核："+str+"</label>\n" +
                            "            </div>\n" +
                            "        </div>\n" +
                            "        ";
                        $("#information_left").append(str1);

                       /* var str1="<div class=\"info\">\n" +
                            "            <div class=\"top\">\n" +
                            "                <div class=\"del\"><a onclick=\"delService("+tid+","+pageNum+")\"> <img src=\"../img/close.png\" style=\"width: 16px;height: 16px\"></a></div>\n" +
                            "                <div style=\"min-width: 200px\">\n" +
                            "                    <!--<img src=\"../img/teacher.jpg\" class=\"info_teach\">-->\n" +
                            "                    <p class=\"specific\">\n" +
                            "                        <label class=\"name\">团队编号:"+tid+"</label><br/><label> 团队名称:"+name+" </label><br/><label>团队负责人:"+username+"  </label><br/><label class=>团队介绍:"+introduce+"</label> <br/></p>\n" +
                            "                </div>\n" +
                            "            </div>\n" +
                            "            <div class=\"info_operation\">\n" +
                            "\n" +
                            "                <label  onclick=\"examine("+pageNum+","+tid+")\"  class=\"operation\"><img src=\"../img/examine.png\" style=\"width: 20px;height: 18px\">审核:"+str+"</label>\n" +
                            "            </div>\n" +
                            "        </div>";
                        if((i+1)==1||(i+1)==4){
                            $("#information_left").append(str1);
                        }if((i+1)==2||(i+1)==5){
                            $("#information_middle").append(str1);
                        }if((i+1)==3||(i+1)==6){
                            $("#information_right").append(str1);
                        }*/
                    }
                }
                if ( data.data.list.length!=0){
                    xuhao(pageNum,pages);
                }else {
                    errorInfo("未查询到相关结果")
                }
            });

        })


        function delService(i,pageno) {
            layer.confirm('是否确认删除？', {
                btn: ['是的','取消'] //按钮
            }, function(){//y
                $.post(mainurl+"admin/deleteTeam",{tid:i},function (data) {
                    if(checkData(data)) {
                        successInfo("删除成功");
                        window.location.href="Admin-TeamInformation.html?pageno="+pageno;
                    }
                });
                layer.closeAll();
            }, function(){

            });
        }



        function tiaozhuan(pageno) {
            $.get(mainurl+"admin/getAllTeam?pageno="+pageno,function (data) {
                var pageNum=data.data.pageNum;
                var pages=data.data.pages;
                var lastPage=data.data.lastPage;
                var size=data.data.size;
                var pageSize=data.data.pageSize;
                if(checkData(data)){
                    $("#information_left").empty();
                    $("#information_middle").empty();
                    $("#information_right").empty();
                    var dat = data.data.list;
                    for(var i=0; i<dat.length; i++) {
                        var d = dat[i];
                        var tid=d.tid;
                        var name=d.name;
                        var username=d.username;
                        var img=mainurl+d.img;
                        var introduce=d.introduce;
                        var audit=d.audit;

                        if(audit==0){
                            str="未审核"
                        }if (audit==1){
                            str="通过";
                        }if (audit==-1) {
                            str="不通过";
                        }

                        str1=" <div class=\"info\">\n" +
                            "            <div class=\"top\">\n" +
                            "                <div class=\"del\"><a onclick=\"delService("+tid+","+pageNum+") \"> <img src=\"../img/close.png\" style=\"width: 16px;height: 16px\"></a></div>\n" +
                            "                <div style=\"min-width: 200px\">\n" +
                            "                    <img src=\""+img+"\" class=\"info_teach\">\n" +
                            "                    <p class=\"specific\">\n" +
                            "                         <label class=\"name\">团队编号:"+tid+"</label><br/><label> 团队名称:"+name+" </label><br/><label>团队负责人:"+username+"  </label><br/><label class=>团队介绍:"+introduce+"</label> </p>\n" +
                            "                </div>\n" +
                            "            </div>\n" +
                            "            <div class=\"info_operation\">\n" +
                            "\n" +
                            "                <label onclick=\"examine("+pageNum+","+tid+")\"  class=\"operation\"><img src=\"../img/examine.png\" style=\"width: 20px;height: 18px\">审核："+str+"</label>\n" +
                            "            </div>\n" +
                            "        </div>\n" +
                            "        ";
                        $("#information_left").append(str1);

                       /* var str1="<div class=\"info\">\n" +
                            "            <div class=\"top\">\n" +
                            "                <div class=\"del\"><a onclick=\"delService("+tid+","+pageNum+")\"> <img src=\"../img/close.png\" style=\"width: 16px;height: 16px\"></a></div>\n" +
                            "                <div style=\"min-width: 200px\">\n" +
                            "                    <!--<img src=\"../img/teacher.jpg\" class=\"info_teach\">-->\n" +
                            "                    <p class=\"specific\">\n" +
                            "                        <label class=\"name\">团队编号:"+tid+"</label><br/><label> 团队名称:"+name+" </label><br/><label>团队负责人:"+username+"  </label><br/><label class=>团队介绍:"+introduce+"</label> <br/></p>\n" +
                            "                </div>\n" +
                            "            </div>\n" +
                            "            <div class=\"info_operation\">\n" +
                            "\n" +
                            "                <label  onclick=\"examine("+pageNum+","+tid+")\"  class=\"operation\"><img src=\"../img/examine.png\" style=\"width: 20px;height: 18px\">审核:"+str+"</label>\n" +
                            "            </div>\n" +
                            "        </div>";

                        if((i+1)==1||(i+1)==4){
                            $("#information_left").append(str1);
                        }if((i+1)==2||(i+1)==5){
                            $("#information_middle").append(str1);
                        }if((i+1)==3||(i+1)==6){
                            $("#information_right").append(str1);
                        }*/
                    }
                }
                $("#xuhao").empty();
                if (pageNum!=0){
                    xuhao(pageNum,pages);
                }else {
                    errorInfo("未查询到相关结果")
                }

            });

        }

    </script>

</head>
<body>
<p class="p1">所在位置：技术服务信息·团队信息</p>
<div class="sousu">
</div>
<div class="container">


    <div class="information" id="information_left"></div>

    <div class="information" style="margin-top: 50px" >
        <div class="page" style="margin-top: 100px;" id="xuhao">
        </div>
    </div>

</div>
<br/>




</body>

<script>
    var user = "";


    function examine(pageno,id) {
        layer.open({
            type: 1,
            title:'审核状态',
            area: ['400px', '200px'],
            closeBtn:1,
            shadeClose: true, //点击遮罩关闭
            content:'<label class="examine_state">'+'审核状态: '+'</label>'+'<select id="zhi" class="examine_sel">'
                +'<option value="0">未审核</option>'+'<option value="1">通过</option>'+'<option value="-1">未通过</option>'+'</select>'
                +'<button id="ex_sub" onclick="shenghe('+pageno+','+id+') ">'+'提交'+'</button>'
        });
    }

    function shenghe(a,b) {
        var zhi=document.getElementById("zhi").value;
        $.post(mainurl+"admin/teamToexamine",{tid:b,audit:zhi},function (data) {
            if(checkData(data)) {
                successInfo("审核信息修改成功");
                window.location.href="Admin-TeamInformation.html?pageno="+a;
            }
        });

    }

    function changepic() {
        var reads= new FileReader();
        f=document.getElementById('file').files[0];
        reads.readAsDataURL(f);
        reads.onload=function (e) {
            document.getElementById('show').src=this.result;
        };
    }
    function del() {
        var self = $(this);
        var flag = $(this).attr('flag');
        layer.confirm('是否确认删除？', {
            btn: ['确定','取消'] //按钮
        },function () {
            $.ajax({
                url: "",
                type: "post",
                data: {id: flag},
                dataType: "json",
                success: function (data) {
                    if(data == 1){
                        layer.msg('删除成功')
                        location.reload();
                    }
                    if (data == 0){
                        layer.msg('删除失败')
                        location.reload();
                    }
                }
            });
        });

    }

    $(function () {
        $('#searchName').click(function() {
            var text = $('#input').val(); //获取文本框输入
            var userName = $("#userName").val();
            if(text == userName ){

            }
        })
    })



</script>
</html>